package ink.ykb.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import ink.ykb.demo.config.CodeConstant;
import ink.ykb.demo.config.MessageUtil;
import ink.ykb.demo.config.ResponseMsg;
import ink.ykb.demo.user.service.UserService;

@RestController("/")
public class MainController {

	@Autowired
	private MessageUtil messageUtil;
	@Autowired
	private UserService userService;

	@GetMapping("/login")
	public ResponseMsg<String> login(String userName, String password) {
		return new ResponseMsg<>(CodeConstant.SUCCESS, messageUtil.getMsg(CodeConstant.SUCCESS),
				userService.login(userName, password));
	}
	
}
